﻿<Window x:Class="EditorExe.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:ExpressionTreeLib;assembly=ExpressionTreeLib"
        xmlns:propgrid="http://schemas.actiprosoftware.com/winfx/xaml/propgrid" Title="MainWindow" Height="365" Width="659">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="277*" />
            <ColumnDefinition Width="360*" />
        </Grid.ColumnDefinitions>
        <TreeView Margin="12,12,3,12" Name="treeView1">
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate ItemsSource="{Binding Children}" >
                    <ContentControl Content="{Binding Name}">
                        <ContentControl.ContextMenu>
                            <ContextMenu ItemsSource="{Binding Commands}">
                                <ContextMenu.ItemTemplate>
                                    <DataTemplate>
                                        <MenuItem Header="{Binding Name}" Command="{Binding}" />
                                    </DataTemplate>
                                </ContextMenu.ItemTemplate>
                            </ContextMenu>
                        </ContentControl.ContextMenu>
                    </ContentControl>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
        <ContentControl Margin="3,12,12,12" Name="stackPanel1" Content="{Binding Path=SelectedValue, ElementName=treeView1}" Grid.Column="1">
            <ContentControl.Resources>
                <DataTemplate DataType="{x:Type local:NodeViewModel}">
                    <propgrid:PropertyGrid AreDefaultSortDescriptionsEnabled="False" Name="pg" Margin="0" SelectedObject="{Binding}">
                        <propgrid:PropertyGrid.DataFactory>
                            <propgrid:TypeDescriptorFactory />
                        </propgrid:PropertyGrid.DataFactory>
                    </propgrid:PropertyGrid>
                </DataTemplate>
            </ContentControl.Resources>
        </ContentControl>
    </Grid>
</Window>
